function ranNum(min,max){
	return Math.floor( Math.random()*(max-min)+min );
}

$(".newUser").mouseenter(function(){
	$(this).css("color","red");
});
$(".phoneUser").mouseenter(function(){
	$(this).css("color","red");
});
$("#phoneNum").blur(function(){
	var inpPhone = $(this).val();
	var rePhone = /^1[3,4,5,7,8]\d{9}$/ ;  //手机号
	if( rePhone.test(inpPhone) ){
		$(this).val( inpPhone );
	}else{
		$(this).val( "请您输入正确的手机号" ).css("color","red");
	}
}).focus(function(){
	$(this).val("").css("color","black");
});
$("#duanxinum").blur(function(){
	var reDuanxin = /^\d{4}$/;  //四位数字的短信验证码;
	var inpDuanxin = $(this).val();
	if( reDuanxin.test(inpDuanxin) ){
		$(this).val( inpDuanxin );
	}else{
		$(this).val( "请您输入正确的短信验证" ).css("color","red");
	}
}).focus(function(){
	$(this).val("").css("color","black");
});
$("#duanxinBtn").click(function(){
	$("#duanxinum").val("6666");  //模拟随机短信验证码
});



$("#email").blur(function(){
	var reEmail = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;  //邮箱;
	var inpEmail = $(this).val();
	if( reEmail.test(inpEmail) ){
		$(this).val( inpEmail );
	}else{
		$(this).val( "邮箱格式不正确" ).css("color","red");
	}
}).focus(function(){
	$(this).val("").css("color","black");
});


$("#pass1").blur(function(){
	var rePass = /^[0-9A-Za-z]{6,20}$/;  //六到二十位区分大小写密码
	var inpPass = $(this).val();
	console.log(rePass.test(inpPass));
	if( rePass.test(inpPass) ){
		$(this).val( inpPass );
	}else{
//		$(this).html( "请您输入符合的密码" ).css("color","red");
		$(this).val("");
		$("#pass1").attr("placeholder","请输入符合的密码");
	}
}).focus(function(){
//	$(this).val("").css("color","black");
	$("#pass1").attr("placeholder","");
	$(this).val("");
});
$("#pass2").blur(function(){
	
	if($("#pass2").val() == $("#pass1").val() ){
		$(this).val( $("#pass1").val() );
	}else{
//		$(this).html( "请您输入符合的密码" ).css("color","red");
		$(this).val("");
		$("#pass2").attr("placeholder","请输入一致的密码");
	}
}).focus(function(){
//	$(this).val("").css("color","black");
	$("#pass1").attr("placeholder","");
	$(this).val("");
});

$(".changeYanzhen").click(function(){
	var arrZimu = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n"];//26个字母 //13
	var yanNum = "";
	for(var i=0;i<4;i++){
		var inNumSui = ranNum(0,13);
		yanNum += arrZimu[inNumSui];
	};
	$(".yanPic2").html( yanNum );
//	for(var i=0;i<4;i++){
//		var inNum =  ranNum(0,13);
//		yanNum　+= arrZimu[inNum];
//	}

	
});

$("#yangzhengma").blur(function(){
	if( $(this).val() ==  $(".yanPic2").html() ){
		$(this).val( $(".yanPic2").html() );
	}else{
		$(this).val( "不正确" ).css("color","red");
	}
}).focus(function(){
	$(this).val("").css("color","black");
});

$("#zhuceBtn").click(function(){
	//alert(  $(".zhuceInformation").find("input").val() != null  ); // true
	if( $("#tongyi").is(":checked") &&( $(".zhuceInformation").find("input").val() != null ) ){
		window.location.href = "zhuceScuess.html";
//		alert("xuanli");
		//将用户信息传入数据中,登录的时候获取判断
//		$.ajax({
//			
//		})
		//此处用户名和密码先放到cookie中
		setCookie("userName", $("#phoneNum").val(),30 ); //30天免登陆
		setCookie("userPass", $("#pass1").val(),30 ); //30天免登陆
		
		
		
		
		
	}else{
		alert("必须同意注册协议才能注册!");
	};
})





























































//用户名:手机或邮箱或会员编号

var re2Emile = /^[A-Za-z_]+([\w-\.]+)([A-Za-z]+)@((\w[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})$/i ; //邮箱
var rePass = /^\d{7}$/   //会员编号  7位数字
